resource "local_file" "ansible_hosts" {
  content = templatefile("${path.module}/templates/hosts.tpl", {
    cp_count            = var.cp_node_count
    cp_ipv4_addresses   = var.cp_ipv4_addresses
    work_count          = var.work_node_count
    work_ipv4_addresses = var.work_ipv4_addresses
    prefix              = var.cluster_name
    ansible_user        = var.ssh_user
  })
  filename             = "${path.module}/hosts"
  file_permission      = 0644
  directory_permission = 0755
}
